#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 5010;
struct ss
{
	int k, s;
}a[N];
bool cmp(ss x, ss y)
{
	if (x.s != y.s)
		return x.s > y.s;
	else
		return x.k < y.k;
}
int main()
{
	int n, m, x;
	cin >> n >> m;
	for (int i = 1; i <= n; i++)
		cin >> a[i].k >> a[i].s;
	x = (int)m * 1.5;
	sort(a + 1, a + n + 1, cmp);
	int cnt = 0;
	for (int i = 1; i <= n; i++)
	{
		if (a[i].s >= a[x].s)
			cnt++;
		else
			break;
	}
	cout <<a[x].s<< " " << cnt << endl;
	for (int i = 1; i <= cnt; i++)
		cout << a[i].k << " " << a[i].s << endl;
	return 0;
}